<template>
  <div class="_p20">
    <div class="_flex _flex-space">
      <el-select v-model="method">
        <el-option label="GET" value="GET" />
        <el-option label="POST" value="POST" />
        <el-option label="PUT" value="PUT" />
        <el-option label="DELETE" value="DELETE" />
      </el-select>
      <el-input v-model="url" />
      <el-button type="primary" @click="submit">发起请求</el-button>
    </div>
    <el-input v-model="data" />
  </div>
</template>

<script setup>
import ToolHttp from "@/tool/http/tool-axios";
import { ref } from "vue";

let url = ref("json-server/test");
let method = ref("GET");
let data = ref();

function submit() {
  ToolHttp.request(url.value, data.value, method.value).then((res) => {
    console.log(res);
  });
}
</script>

<style scoped></style>
